import { get } from 'lodash-es'

export class Name {
  id?: string
  hotel_id?: string
  last_name?: string
  first_name?: string
  full_name?: string
  xlast_name: string
  xfirst_name: string
  xfull_name?: string
  language_id?: string
  guest_title_id?: string
  gender_id?: string
  saler_id?: string
  mobile?: string
  email?: string
  vip_id?: string
  company_name?: string
  position_name?: string
  document_type_id?: string
  document_number?: string
  birth_date?: string | Date
  country_id?: string
  state_id?: string
  city?: string
  address?: string
  postal_code?: string
  reference?: string
  created_id?: string
  updated_id?: string
  created_at?: string
  updated_at?: string
  guest_feature_ids?: Array<string>
  guest_features?: Array<any>
  version?: number;
  [key: string]: any

  constructor(data?: Name) {
    this.xlast_name = ''
    this.xfirst_name = ''
    this.init(data)
  }
}

Name.prototype.init = function init(data?: Name) {
  this.id = get(data, 'id')
  this.hotel_id = get(data, 'hotel_id')
  this.last_name = get(data, 'last_name')
  this.first_name = get(data, 'first_name')
  this.xlast_name = get(data, 'xlast_name', '')
  this.xfirst_name = get(data, 'xfirst_name', '')
  this.xfull_name = get(data, 'xfull_name', '')
  this.language_id = get(data, 'language_id')
  this.guest_title_id = get(data, 'guest_title_id')
  this.gender_id = get(data, 'gender_id')
  this.saler_id = get(data, 'saler_id')
  this.mobile = get(data, 'mobile')
  this.email = get(data, 'email')
  this.vip_id = get(data, 'vip_id')
  this.company_name = get(data, 'company_name')
  this.position_name = get(data, 'position_name')
  this.document_type_id = get(data, 'document_type_id')
  this.document_number = get(data, 'document_number')
  this.birth_date = get(data, 'birth_date')
  this.country_id = get(data, 'country_id')
  this.state_id = get(data, 'state_id')
  this.city = get(data, 'city')
  this.address = get(data, 'address')
  this.postal_code = get(data, 'postal_code')
  this.reference = get(data, 'reference')
  this.created_id = get(data, 'created_id')
  this.updated_id = get(data, 'updated_id')
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.guest_feature_ids = get(data, 'guest_feature_ids', [])
  this.guest_features = get(data, 'guest_features', [])
  this.version = get(data, 'version')
}
